﻿<%--
 *  File:    ApprovalFailTempDetail812.jsp
 *  @Author: shigang
 *  Date:    2013/04/24
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval. 
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.ApprovalFailTempDetail"); 
%>

<% //--------------------------------------  variant and initialization --%>
<%
    String strModuleName = "COM";
  	String strTableName = "";
  	String privilegeCode = "FP030020";
  	String contextPath = request.getContextPath();
%>



<%
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

String strFromuserid = (CurUserInfo.get("userid")).toString();
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<title>ApprovalFailTempDetail</title>
<PageFlow:CheckPageFlow pageName="approvalfailmonthplandetail"/>
<% //--------------------------------------  output variant from pageflow --%>
<%

  	Vector userGroupSummary = (Vector)pageContext.getAttribute("ugsummary");
  	if(userGroupSummary == null)
  	{
  		userGroupSummary = new Vector();
  	}
  	
  
  	String subjectcode = (String)pageContext.getAttribute("subjectcode");
  	
  	Integer dimension = (Integer)pageContext.getAttribute("dimension");
  	
  	Integer monthplanid = (Integer)pageContext.getAttribute("monthplanid");
  	
  	Integer monthplanapprovalid = (Integer)pageContext.getAttribute("monthplanapprovalid");
  	
  	Integer plevel = (Integer)pageContext.getAttribute("planlevel");
  	int planlevel = 0;
	if(plevel!=null)
  	{
		planlevel = plevel.intValue();
  	}
%>
<%@ include file="/inc/InitEdit.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/boxover.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/opal2/mootools.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(usergroupsummaryform,actionvalue,orderbyname);
  editform.action = "ApprovalFailMonthPlanDetail.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}


function allcheckselect(){
	var allcheck = usergroupsummaryform.allcheck.checked;
	var alldatafile = document.getElementsByName('batchnoidstr');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}


function editMode(obj,index,name,id) {
    if ($(name + index) == null) {
        var c = Trim(obj.innerText);
        var t = new Element('input', {
            'type':'text',
            'value':c,
            'styles':{
                    'width':'500px'
                     },
            'id':name + index,
            'name':name,
            'events':{
                'blur':function() {
                    saveData(this,id,c);
                },
                'keydown':function() {
                    if (event.keyCode == 13) {
                        saveData(this,id,c);
                    }
                }
            }
        });
       
        obj.innerHTML = '&nbsp;';
        t.inject(obj);
        selectText(t);
    }
}

function saveData(obj,id,c) {
    var p = obj.parentNode;
    var fromusrid= document.usergroupsummaryform.fromuserid.value ;
    var subjectcode = document.usergroupsummaryform.subjectcode.value ;
    var begindate = document.usergroupsummaryform.begindate.value ;
    p.innerHTML = obj.value;
    var req = new Request({
        'url':'<%=contextPath%>/Dispatcher',
        'method':'get',
        'data':'pagename=approvalfailtempdetail&actionname=save&columnname=' + obj.name + '&columnvalue='+ encodeURI(obj.value) + '&transactionid=' + id+'&transactioncode=' + id +'&fromuserid='+fromusrid+ '&subjectcode='+subjectcode+'&begindate='+begindate
    });
    req.send(); 
    window.location.reload();
}

//选中文本框中的字符


function selectText(obj) {
    var range = obj.createTextRange();
    range.moveStart("character", 0);
    range.select();
}

/*
function page_update(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	var alldatafile = document.getElementsByName('brandcodes');
	var length = alldatafile.length;
		for(var i=0;i<length;i++){
	      var j=i+1;
		  if(alldatafile[i].checked){
		    var approvalproposal=eval("document.usergroupsummaryform.approvalproposal111"+j).value;
			if(approvalproposal=="")
			{
				alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Approve",false)) %>");
		        return;
			}
		  }
		}
    
	document.usergroupsummaryform.actionname.value = "update";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_agree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "agree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_disagree(){
    if(isNullChecked(document.usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	var alldatafile = document.getElementsByName('brandcodes');
	var length = alldatafile.length;
		for(var i=0;i<length;i++){
	      var j=i+1;
		  if(alldatafile[i].checked){
		    var approvalproposal=eval("document.usergroupsummaryform.nc0"+j).value;
			if(approvalproposal=="")
			{
				alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Approve",false)) %>");
		        return;
			}
		  }
		}
	document.usergroupsummaryform.actionname.value = "disagree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}
*/
function page_done(a_str)

{ 
 var approvalnoteseditform= document.usergroupsummaryform;
 if(isNullChecked(approvalnoteseditform.batchnoidstr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }
 var alldatafile = document.getElementsByName('batchnoidstr');
 var length = alldatafile.length;
 for(var i = 0 ; i < length;i++){
  if (alldatafile[i].checked){
  
	var objstatus=eval('usergroupsummaryform.status'+i);
	
	 if ( objstatus.value!=20){
        alert("<%=message.getMessageDesc("J_STATUS_CHECK_ERROR")%>");
      return;
  }
  }
 }

 if(a_str=="agree")
    {
      if (isAllSpace(approvalnoteseditform.nt0.value)){
     
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_Agree",false)%>";
      }else{
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_Agree",false) + label.getLabelName("L_Colon")%>"+approvalnoteseditform.nt0.value;
      }
    	approvalnoteseditform.actionname.value = "approvepassed";
    }else if(a_str=="deny"){
   
      if (isAllSpace(approvalnoteseditform.nt0.value)){
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_Refuse",false)%>";
      }else{
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_Refuse",false) + label.getLabelName("L_Colon")%>"+approvalnoteseditform.nt0.value;
      }
        approvalnoteseditform.actionname.value = "approvedenied";
    }
    else if(a_str=="disagree"){
   
      if (isAllSpace(approvalnoteseditform.nt0.value)){
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_NotAgree",false)%>";
      }else{
        approvalnoteseditform.nt0.value = "<%= label.getLabelName("L_NotAgree",false) + label.getLabelName("L_Colon")%>"+approvalnoteseditform.nt0.value;
      }
        approvalnoteseditform.actionname.value = "approvepassed";
        
    }
   
    setValue();
   
    approvalnoteseditform.pagename.value="approvalnotesedit";
    approvalnoteseditform.target = "_self";
    isRunning = true;
    approvalnoteseditform.submit();
    }
    
    function setValue()
{
   var frm = document.usergroupsummaryform;
   frm.nt1.value = frm.nt0.value;
   frm.nc1.value = frm.nc0.value;
}
function page_back(){

	var subjectcode =document.usergroupsummaryform.subjectcode.value;
	self.location.href ="MonthPlanApprovalFailSummary.jsp?<%= OvalTools.randomURL() %>"+"&planlevel=<%=planlevel%>"+"&subjectcode="+subjectcode;
}
function page_approval()
{
  var frm = document.usergroupsummaryform;

  frm.pagename.value = "approvalfailsummary";
  frm.actionname.value = "approve";
  frm.target = "_parent";
  isRunning = true;
  frm.submit();

}
</script>

<%
String strLanguageCode0;
  String strLanguageCode1;
  if(strLanguageCode.equalsIgnoreCase("cn"))
  {
	strLanguageCode0 = "cn";
	strLanguageCode1 = "en";
  }else{
	strLanguageCode0 = "en";
	strLanguageCode1 = "cn";    
  }%>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

	<% //--------------------------------------  hidden form variant --%>
	<form name="usergroupsummaryform" method="post" action="../../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="approvalfailmonthplandetail">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

    <input type="hidden" name="subjectcode" value="<%=subjectcode %>"/>
    <input type="hidden" name="planlevel" value="<%=planlevel%>"/>
    <input type="hidden" name=dimension value="<%=dimension%>"/>
    <input type="hidden" name="monthplanid" value="<%=monthplanid%>"/>
    <input type="hidden" name="monthplanapprovalid" value="<%=monthplanapprovalid%>"/>
    
	
    <input type="hidden" name="fromuserid" value="<%=JspHelper.filterNull( strFromuserid)%>">
    <input type="hidden" name="begindate" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">
       <input type="hidden" name="languagecode0" value="<%= strLanguageCode0 %>">
    <input type="hidden" name="languagecode1" value="<%= strLanguageCode1 %>">
    <input type="hidden" name="nt0">
      <input type="hidden" name="nt1">
        <input type="hidden" name="nc1">
          <input type="hidden" name="nc0">
    <input type="hidden" name="numrows" value="2">
	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
	
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
  	<tr> 
    	<td valign="top"> 
    		<table width="100%" border="0" cellspacing="0">
          	<tr><td class="summary_top" ></td></tr>
        	</table>
        </td>
   	</tr>
   	</table>
<div style="overflow:auto;width:1230;height:400">   
   	<table width="1500"  border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
 	
  
            <tr class="deepblue-left">
			  
			 
              <td class="title_center" ><%= label.getLabelName("L_PlanCode") %></td>
             
              
               <%if(planlevel==5){  %>
              <td class="title_center" ><%= label.getLabelName("L_RegionOffice")+label.getLabelName("L_Code") %></td>
              <td class="title_center" ><%= label.getLabelName("L_RegionOffice")+label.getLabelName("L_Name") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Employee")+label.getLabelName("L_Code") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Employee")+label.getLabelName("L_Name") %></td>
              <%}else{  %>
              <td class="title_center" ><%= label.getLabelName("L_last")+label.getLabelName("L_Code") %></td>
              <td class="title_center" ><%= label.getLabelName("L_last")+label.getLabelName("L_Name") %></td>
              <%} %>
              <% if (planlevel==2){  %>
              <td class="title_center" ><%= label.getLabelName("L_Provicetdr")+label.getLabelName("L_Code") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Provicetdr")+label.getLabelName("L_Name") %></td>
              <%} %>
             <% if (planlevel==1){  %>
               <td class="title_center" ><%= label.getLabelName("L_Department")+label.getLabelName("L_Code") %></td>
               <td class="title_center" ><%= label.getLabelName("L_Department")+label.getLabelName("L_Name") %></td>
             <%} %>
              <% if (planlevel==4){  %>
              <td class="title_center" ><%= label.getLabelName("L_Person")+label.getLabelName("L_Code") %></td>
              <td class="title_center" ><%= label.getLabelName("L_Person")+label.getLabelName("L_Name") %></td>
              <%} %>
              <% if (planlevel==5){  %>
               <td class="title_center" ><%= label.getLabelName("L_Customer")+label.getLabelName("L_Code") %></td>
               <td class="title_center" ><%= label.getLabelName("L_Customer")+label.getLabelName("L_Name") %></td>
              <%} %>  
              <td class="title_center" ><%= label.getLabelName("L_ProductOrProductGroup") %></td>
              <td class="title_center" ><%= label.getLabelName("L_OneMonth") %></td>
              <td class="title_center" ><%= label.getLabelName("L_TwoMonth") %></td>
              
              
              <td class="title_center" ><%= label.getLabelName("L_ThreeMonth") %></td>
              <td class="title_center" ><%= label.getLabelName("L_FourMonth") %></td>
              <td class="title_center" ><%= label.getLabelName("L_FiveMonth") %></td>
              <td class="title_center" ><%= label.getLabelName("L_SixMonth") %></td>
              <td class="title_center" ><%= label.getLabelName("L_SevenMonth") %></td>              
              <td class="title_center" ><%= label.getLabelName("L_EightMonth") %></td>
              
			  <td class="title_center" ><%= label.getLabelName("L_NineMonth") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_TenMonth") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_ElevenMonth") %></td>
			  <td class="title_center" ><%= label.getLabelName("L_TwelveMonth") %></td>
              
             
            </tr>

	<% //--------------------------------------  default value definition --%>
    <%
    	int i=0;
        Integer nDefaultzyldealerapproveid = new Integer(-1);               
        String strClassType = new String(); 
        boolean bHasChecked = false;
        String strDefaultIsDisabled="";
      
   	%>
   	
    <% //--------------------------------------  loop results --%>
     <span id="olddetail" >
    <logic:iterate id="usergroup" collection="<%= userGroupSummary %>" indexId="idx" scope="page">                      
    	
    <%
    	HashMap userGroupMap = (HashMap)pageContext.getAttribute("usergroup"); 
        String strIsDisabled = "";
        String strIsChecked = "";
            
        if(i%2==0){
            strClassType="td-listrom";
        } else{
            strClassType="none";
        } 
       if(!bHasChecked)
        {
	        strIsChecked = "Checked";                       
            bHasChecked = true;
            nDefaultzyldealerapproveid = (Integer)(userGroupMap.get("zyldealerapproveid"));
           
          	strDefaultIsDisabled = strIsDisabled;            
        }  
       i++;
  	%>
    
    
    <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>">


			  <td><custom:write property="monthplanapprovalcode" name="usergroup" nbsp="true"/></td>
             <!-- <td><custom:write property="lastgrade" name="usergroup" nbsp="true"/></td> --> 
              <%if(planlevel==5){  %>
			   <td><custom:write property="areacode" name="usergroup" nbsp="true"/></td>
               <td><custom:write property="areaname" name="usergroup" nbsp="true"/></td>
			   <%} %>
			  <td><custom:write property="lastgradecode" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="lastgradename" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="currentgradecode" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="currentgradename" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="prodname" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="jan" name="usergroup" nbsp="true"/></td>
              
              <td><custom:write property="feb" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="thu" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="mar" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="may" name="usergroup" nbsp="true"/></td>
              <td><custom:write property="june" name="usergroup" nbsp="true"/></td>              
              <td><custom:write property="july" name="usergroup" nbsp="true"/></td>              
              <td><custom:write property="aug" name="usergroup" nbsp="true"/></td>
              
              <td><custom:write property="sep" name="usergroup"  nbsp="true"/></td>
              <td><custom:write property="oct" name="usergroup"  nbsp="true"/></td>
              <td><custom:write property="nov" name="usergroup"  nbsp="true"/></td>
              <td><custom:write property="dec" name="usergroup"  nbsp="true"/></td>         
          
			 </tr>

            
    </logic:iterate>  
    
    <input type="hidden" name="zyldealerapproveid" value="<%=JspHelper.filterNull( nDefaultzyldealerapproveid )%>">

    
</span>
<!--		<tr> -->
	<!--			<td colspan="66" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write property="count" name="count" nbsp="true"/></td> -->
	<!--		</tr> -->
            <%@ include file="/inc/SummaryActionUP.inc" %>

          </table>
    
 </div>   
    <% //--------------------------------------  page operation button --%>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr> 
        	<td class="summary_top" ></td>
        </tr>
        <tr> 
        	<td class="td_center"> 
        	
        		<!-- 
        		<a onclick="page_done('agree')"><custom:button type="1" label="L_Agree" imgsrc="new.gif" border="0" style="width:60"/></a>
        		<a onclick="page_done('disagree')"><custom:button type="1" label="L_NotAgree" imgsrc="edit.gif" border="0" style="width:60"/></a>
        		<a onclick="page_done('deny')"><custom:button type="1" label="L_Deny" imgsrc="delete.gif" border="0" style="width:60"/></a>  
    			-->
        		<a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>      		
        	</td>
        </tr>
  	</table>

</form>
<!-- 
<script>
  var myform = eval("document.usergroupsummaryform");
  <--% if (subjectcode.equalsIgnoreCase("812")){  %>
   var arr=["hpcode","hpname","doctorcode","doctorname","englishname","statusname","gendername","nativeplace","departmentname","jobtitlename","dutytime","birthday","birthdaycn","idcardno","college","profession","graduatedate","address","zipcode","interest","telephone","cellphone","email","societytitle","comments","attr101","attr102","attr103","attr104","attr105"];
    for(var i=0;i<<%=userGroupSummary.size()%>;i++){
	for(var j=0;j<arr.length;j++){
		var obj=eval("myform."+arr[j]+i);
		var oldobj=eval("myform.old"+arr[j]+i);
		if(obj!=null)
		{
			if(obj.value==oldobj.value){
			  document.getElementById(arr[j]+"_"+i).style.color="black";
			  document.getElementById(arr[j]+"_"+i).title="";
			}
			if(isEmpty(obj.value) && !isEmpty(oldobj.value)){
			  //document.getElementById(arr[j]+"_"+i).title="";
			  document.getElementById(arr[j]+"_"+i).innerText="空";
			}
		}
		
	}			
   }
 <--%}%-->


 
</script> 
</body>
</html>


